<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_log')->create('log_policy_open', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('记录同意过隐私政策的用户');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->string('device_num', 32)->comment('自定义唯一id')->default('');
            $table->string('ip', 64)->comment('ip')->default('');
            $table->integer('agree_time')->comment('同意时间')->unsigned()->default(0);
            $table->string('agree_ip', 64)->comment('同意ip')->default('');
            $table->tinyInteger('is_agree')->comment('是否同意 1是 0否')->unsigned()->default(0);

            $table->index('create_time');
            $table->index('game_id');
            $table->index('device_num');
            $table->index('agree_time');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_log')->dropIfExists('log_policy_open');
    }
};
